<template>
    <div class="container" v-loading="loading">
        <el-form :inline="true" :model="searchForm.data" ref="searchFormRef" size="default" status-icon class="demo-form-inline" label-width="74px" label-position="right">
            <div>
                <el-form-item class="nine-form-title" label="学年" prop="yearly">
                    <el-select placeholder="请选择" v-model="searchForm.data.yearly" clearable @change="getPermissionArea('areaId')">
                        <el-option  v-for="(item, index) in yearlist" :key="index" :label="item.key" :value="item.value"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item class="nine-form-title" prop="subjectType" label="班级科目">
                    <el-select placeholder="请选择"  v-model="searchForm.data.subjectType" clearable >
                        <el-option  label="主三科" value="2"></el-option>
                        <el-option  label="主三科+史地政" value="0"></el-option>
                        <el-option  label="主三科+物化生" value="1"></el-option>
                        <el-option  label="主三科+物化生史地政" value="3"></el-option>
                        <el-option  label="物理" value="4"></el-option>
                        <el-option  label="化学" value="5"></el-option>
                        <el-option  label="生物" value="6"></el-option>
                        <el-option  label="历史" value="7"></el-option>
                        <el-option  label="地理" value="8"></el-option>
                        <el-option  label="政治" value="9"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item class="nine-form-title" label="上课校区" prop="areaId">
                    <el-select placeholder="请选择" v-model="searchForm.data.areaId" :clearable="queryListAll.data['areaList'] && queryListAll.data['areaList'].length!=1" @change="getPermissionArea">
                        <el-option  v-for="item in queryListAll.data['areaList']" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                </el-form-item>
            </div>
            <!--  <div v-show="!showOtherParams">
                <el-form-item class="nine-form-title" prop="classId" label="班级ID">
                    <el-input  v-enter-number  v-model="searchForm.data.classId" maxlength="5" clearable></el-input>
                </el-form-item> 
                <el-form-item class="nine-form-title" prop="className" label="班级名称">
                    <el-input type="text" v-model="searchForm.data.className" maxlength="50" clearable></el-input>
                </el-form-item>
            </div> -->
            <div class="hide-row">
                <div>
                    <el-form-item class="nine-form-title" prop="grade" label="年级">
                        <el-select placeholder="请选择"  v-model="searchForm.data.grade" @change="getPermissionArea('areaId')">
                            <el-option  v-for="item in queryListAll.data['gradeList']" :key="item.id" :label="item.name" :value="item.id"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item class="nine-form-title" prop="productIds" label="产品线">
                        <el-select placeholder="请选择（可多选）"  v-model="searchForm.data.productIds" multiple collapse-tags clearable>
                            <el-option  v-for="(item, index) in productList" :key="index" :label="item.key" :value="item.value"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item class="nine-form-title" prop="paperType" label="试卷类型">
                        <el-select placeholder="请选择"  v-model="searchForm.data.paperType" clearable>
                            <el-option  label="北京卷" value="0"></el-option>
                            <el-option  label="全国卷" value="1"></el-option>
                        </el-select>
                    </el-form-item>
                </div>   
                <div>                 
                    <el-form-item class="nine-form-title" prop="classType" label="班级类型">
                        <el-select placeholder="请选择"  v-model="searchForm.data.classType" clearable>
                            <el-option  label="行政班" value="0"></el-option>
                            <el-option  label="教学班" value="1"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item class="nine-form-title" prop="classId" label="班级ID">
                        <el-input v-model="searchForm.data.classId" maxlength="5" clearable></el-input>
                    </el-form-item> 
                    <el-form-item class="nine-form-title" prop="className" label="班级名称">
                        <el-input type="text" v-model="searchForm.data.className" maxlength="50" clearable></el-input>
                    </el-form-item>
                </div> 
            </div> 
            <div>
                <el-form-item >
                    <el-button type="primary" @click="toAdd()">新增</el-button>  
                    <el-button type="primary" @click="goRelateClass">一键关联班级</el-button>  
                    <el-button type="primary" @click="exportData">导出</el-button>
                    <el-button @click="getTableData('first')">查询</el-button> 
                </el-form-item>    
                <!--   <div class="box-p-pre">
                    <p class="box-p" @click="showOtherParams =! showOtherParams">
                        <span v-if="!showOtherParams">【显示- 更多查询项】</span>
                        <span v-if="showOtherParams">【隐藏- 更多查询项】</span>
                    </p>
                </div> -->
            </div> 
                                
            
        </el-form>
        <el-table 
            :data="tableData" 
            border
            highlight-current-row 
            class="table" 
            ref="multipleTable" 
            :header-cell-style="{background: '#f1f1f1', color: '#333'}" >
            <!-- <el-table-column label="序号" align="center" width="50"  hidden="hidden">
                <template scope="scope"><span>{{scope.$index+(pageNo- 1) * pageSize + 1}} </span></template>
            </el-table-column> -->
            <el-table-column prop="sort" header-align="center" align="center" width="60" label="序号"></el-table-column>
            <el-table-column prop="classId" header-align="center" align="center" width="70" label="班级ID"></el-table-column>
            <el-table-column prop="className" header-align="center" align="center" label="班级名称"></el-table-column>
            <el-table-column prop="gradeStr" header-align="center"  align="center" label="年级"> </el-table-column>
            <el-table-column prop="areaName" header-align="center" align="center" label="上课校区"></el-table-column>
            <el-table-column prop="classType" header-align="center" align="center" label="班级类型">
                    <template #default="scope">
                    <el-col v-if="scope.row.classType == 0">行政班</el-col>
                    <el-col v-else>教学班</el-col>
                </template>
            </el-table-column>
            <el-table-column prop="bjbx" header-align="center" align="center" label="班级班型">
                    <template #default="scope">
                    <el-col v-if="scope.row.bjbx == 632">标准班</el-col>
                    <el-col v-if="scope.row.bjbx == 633">精品班</el-col>
                    <el-col v-if="scope.row.bjbx == 634">精粹班</el-col>
                </template>
            </el-table-column>
            <el-table-column prop="subjectType" header-align="center" align="center" label="班级科目">
                <template #default="scope">
                    <el-col v-if="scope.row.subjectType == 0">主三科+史地政</el-col>
                    <el-col v-else-if="scope.row.subjectType == 1">主三科+物化生</el-col>
                    <el-col v-else-if="scope.row.subjectType == 3">主三科+物化生史地政</el-col>
                    <el-col v-else-if="scope.row.subjectType == 2">主三科</el-col>
                    <el-col v-else-if="scope.row.subjectType == 4">物理</el-col>
                    <el-col v-else-if="scope.row.subjectType == 5">化学</el-col>
                    <el-col v-else-if="scope.row.subjectType == 6">生物</el-col>
                    <el-col v-else-if="scope.row.subjectType == 7">历史</el-col>
                    <el-col v-else-if="scope.row.subjectType == 8">地理</el-col>
                    <el-col v-else-if="scope.row.subjectType == 9">政治</el-col>
                    <el-col v-else></el-col>
                </template>
            </el-table-column>
            <el-table-column prop="realname" header-align="center" align="center" label="班主任"></el-table-column>
            <el-table-column prop="teacherNames" header-align="center" align="center" label="授课教师" max-width="120" show-overflow-tooltip></el-table-column>
            <el-table-column prop="realNum" header-align="center" align="center" label="在班人数"></el-table-column>
            <el-table-column prop="totalNum" header-align="center" align="center" label="名额"></el-table-column>
            <!-- <el-table-column prop="quota" header-align="center" align="right" label="名额">
                <template slot-scope="scope">
                    <el-col>{{scope.row.realNum +"/" + scope.row.totalNum}}</el-col>
                </template>
            </el-table-column> -->
            <el-table-column prop="doorPlate" header-align="center" align="center" label="教室"></el-table-column>
            <!-- <el-table-column prop="paperType" header-align="center" align="center" label="卷种">
                <template slot-scope="scope">
                    <el-col v-if="scope.row.paperType == 0">北京卷</el-col>
                    <el-col v-else>全国卷</el-col>
                </template>
            </el-table-column> -->
            <el-table-column prop="status" header-align="center" width="80" align="center" label="状态">
                <template #default="scope">
                    <el-tag v-if="scope.row.status == 0" size="small" type="danger">禁用</el-tag>
                    <el-tag v-else size="small">正常</el-tag>
                </template>
            </el-table-column>
            <el-table-column label="操作" width="220" align="left" header-align="center">
                <template #default="scope">
                    <el-button link type="primary" size="small" @click="editSort(scope.$index, scope.row)"><el-icon><Flag /></el-icon>序号</el-button>
                    <el-button link type="primary" size="small" @click="editClass(scope.$index, scope.row)"><el-icon><Edit /></el-icon>编辑</el-button>
                    <el-button link type="primary" size="small" @click="viewStudent(scope.$index, scope.row)"><el-icon><View /></el-icon>学生名单</el-button>
                    <el-button v-if="scope.row.source == 0 && scope.row.realNum == 0" size="small" class="red" link @click="handleDelete(scope.row)"><el-icon><Delete /></el-icon>删除</el-button>
                </template>
            </el-table-column>
        </el-table>
        <!-- <el-divider>
            <p><span>总人数：</span><span class="el_div_num" @click="toStuDetails">{{studentNum}}</span><span>平均班额：{{avgNum}}</span></p>
        </el-divider> -->
        <div class="pagination">
            <el-pagination
                @size-change="sizeChangeHandle"
                @current-change="currentChangeHandle"
                :current-page="pageNo"
                :page-sizes="[10,20,50]"
                :page-size="pageSize" 
                :total="totalPage"
                layout="total, sizes,prev, pager, next, jumper">
            </el-pagination>
        </div>
        <div class="totalN">
            <div>
                <p>
                    <strong>行政班：</strong>
                    <span class="el_div_num" @click="toStuDetails" v-if="!allNum.studentNum"><strong>0</strong></span>
                    <span class="el_div_num" @click="toStuDetails" v-else><strong>{{allNum.studentNum}}</strong></span>
                    <strong>平均班额：</strong>
                    <span v-if="!allNum.avgNum"><strong>0.00</strong></span>
                    <span v-else><strong>{{allNum.avgNum}}</strong></span>
                </p>
            </div>
            <div>
                <p>
                    物理班：<span v-if="!allNum.studentNum104">0</span><span v-else>{{allNum.studentNum104}}</span>
                    平均班额：<span v-if="!allNum.avgNum104">0.00</span><span v-else>{{allNum.avgNum104}}</span>
                </p>
                <p>
                    化学班：<span v-if="!allNum.studentNum105">0</span><span v-else>{{allNum.studentNum105}}</span>
                    平均班额：<span v-if="!allNum.avgNum105">0.00</span><span v-else>{{allNum.avgNum105}}</span>
                </p>
                <p>
                    生物班：<span v-if="!allNum.studentNum106">0</span><span v-else>{{allNum.studentNum106}}</span>
                    平均班额：<span v-if="!allNum.avgNum106">0.00</span><span v-else>{{allNum.avgNum106}}</span>
                </p>
            </div>
            <div>
                <p>
                    历史班：<span v-if="!allNum.studentNum107 ">0</span><span v-else>{{allNum.studentNum107}}</span>
                    平均班额：<span v-if="!allNum.avgNum107">0.00</span><span v-else>{{allNum.avgNum107}}</span>
                </p>
                <p>
                    地理班：<span v-if="!allNum.studentNum108">0</span><span v-else>{{allNum.studentNum108}}</span>
                    平均班额：<span v-if="!allNum.avgNum108">0.00</span><span v-else>{{allNum.avgNum108}}</span>
                </p>
                <p>
                    政治班：<span v-if="!allNum.studentNum109 ">0</span><span v-else>{{allNum.studentNum109}}</span>
                    平均班额：<span v-if="!allNum.avgNum109 ">0.00</span><span v-else>{{allNum.avgNum109}}</span>
                </p>
            </div>
        </div>
        <!--一键关联班级弹出框 -->
        <el-dialog title="选择考试批次" draggable v-model="relateVisible" width="500px" :close-on-click-modal="false">
            <div class="el-dialog-div">
                <el-form label-position="right" class="zl-dialog" ref="relateRules" :rules="relateRules" :model="relateForm" label-width="110px">
                    <el-form-item class="header-title" prop="grade" label="年级">
                        <el-select placeholder="请选择" v-model="relateForm.grade" @change="getPermissionArea('testId')">
                            <el-option  v-for="item in queryListAll.data['gradeList']" :key="item.id" :label="item.name" :value="item.id"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item class="header-title" label="考试批次" prop="testId">
                            <el-select v-model="relateForm.testId" placeholder="请选择">
                                <el-option v-for="item in testList" :key="item.testId" :label="item.simpleName" :value="item.testId"></el-option>
                            </el-select>
                        </el-form-item>
                </el-form>
            </div>
            <template #footer>
                <span class="dialog-footer">
                    <el-button @click="resetRelate">取 消</el-button>
                    <el-button type="primary" @click="toSaveRelate()">关联班级</el-button>
                </span>
            </template>            
        </el-dialog>

        <!-- 删除提示框 -->
        <el-dialog title="提示" v-model="delVisible" width="300px" center>
            <div class="del-dialog-cnt">删除不可恢复，是否确定删除？</div>
            <span slot:footer="footer" class="dialog-footer">
                <el-button @click="delVisible = false">取 消</el-button>
                <el-button type="primary" @click="deleteRow">确 定</el-button>
            </span>
        </el-dialog>
        <!--编辑序号弹出框 -->
        <el-dialog title="编辑排序" draggable v-model="sortVisible" width="30%" :close-on-click-modal="false" @close="resetForm('sortRulesRef')">
            <div class="el-dialog-div">
                <el-form label-position="right" class="zl-dialog" ref="sortRulesRef" :rules="sortRules" :model="sortForm" label-width="60px">
                    <el-form-item class="header-title" label="序号" prop="sort">
                        <el-input v-model="sortForm.sort" @input="changeInput" maxlength="4"></el-input>
                    </el-form-item>
                </el-form>
            </div>
            <template #footer>
                <span slot:footer="footer" class="dialog-footer">
                    <el-button @click="resetForm('sortRulesRef')">取 消</el-button>
                    <el-button type="primary" @click="toSortSave(sortRules)">保 存</el-button>
                </span>
            </template>           
        </el-dialog>
    </div>
</template>

<script setup lang="ts">
// 教务-第一个班级管理
import {crmUrl} from '@/utils/api';  
import {mapGetters, mapMutations, mapActions, useStore} from 'vuex';
// import saveFlag from '@/mixin/saveFlag'; //重复提交
import inputNumber from "@/components/common/input-number.vue";
import { onMounted, ref, getCurrentInstance, reactive, onActivated } from 'vue';
import { onBeforeRouteLeave, onBeforeRouteUpdate, useRoute,useRouter } from "vue-router";
import useSaveFlag from '@/mixin/saveFlag';
import baseService from '@/service/baseService';

function downFile(blob, fileName) {
    if (window.navigator.msSaveOrOpenBlob) {
        navigator.msSaveBlob(blob, fileName);
    } else {
        var link = document.createElement('a');
        link.href = window.URL.createObjectURL(blob);
        link.download = fileName;
        link.click();
        window.URL.revokeObjectURL(link.href);
    }
}
const router = useRouter();
const route = useRoute();
const store = useStore();
//获取上下文实例，ctx=vue2的this
const { ctx,proxy } = getCurrentInstance();
// reactive声明响应式数据，用于声明引用数据类型
const searchForm = reactive({
    data: {
        subjectType:'',
        areaId:'',
        className:'',
        productIds: [],
        yearly: 211,
        classId:'',
        paperType:'',
        grade:'',
        classType:''
    }
});
let loading =ref(false);
let tableData = ref([]);
let pageNo =ref(0);
let pageSize = ref(10);
let totalPage = ref(0);
let yearlist = ref([]);
let productList = ref([]);
let arealist = ref([]);
let delVisible = ref(false);
let isDel = ref(false);
//一键关联班级
let dialogLoading= ref(false);
let relateVisible=ref(false);
let relateForm=reactive({
    testId: '',
    grade: '',
});
let relateRules= ref({
    grade:[{required:true,message:'请选择年级!',trigger:'change'}],
    testId:[{required:true,message:'请选择考试批次!',trigger:'change'}]
});
let testList=ref([]);
let dataParam=ref({}); //保存时做转换的参数存储 
let sortVisible=ref(false);
let sortForm=reactive({
    sort:''
});
let sortRules=ref({
    sort:[{ required: true, message:"请输入序号", trigger:'change'}]
});
const sortRulesRef = ref(null)
let allNum = reactive({
    studentNum: 0,
    studentNum104:0,
    studentNum105:0,
    studentNum106:0,
    studentNum107:0,
    studentNum108:0,
    studentNum109:0,
    avgNum:0.00,
    avgNum104:0.00,
    avgNum105:0.00,
    avgNum106:0.00,
    avgNum107:0.00,
    avgNum108:0.00,
    avgNum109:0.00,
});

let menuParams=reactive({});//菜单参数
let userInfo=reactive({});
let queryListAll= reactive({
    data: {}
}); //所有查询列表
onMounted(()=>{
    getSessionSearch();
    // window.dialogAddSave = dialogAddSave;
});
let getSessionSearch= async ()=>{
    if(JSON.stringify(router.currentRoute.value.params)!='{}'){
        searchForm.data = {...searchForm.data,...router.currentRoute.value.params};
    }else{
        let search = JSON.parse(window.sessionStorage.getItem("vuex"))
        if(search.showqrzclassmanage.menuParams && JSON.stringify(search.showqrzclassmanage.menuParams)!='{}'){
            menuParams = {...menuParams, ...search.showqrzclassmanage.menuParams};
        }    
    }
    await getYears();
    await getNowYear();
    await setTimeout(()=>{
       getUserInfo();
    }, 0)
    // getTableData();
    await getProductList();  
};
let getYears = ()=>{
    //获取学年
    baseService.post(crmUrl +'/ft/campus/getSchoolYearList.do').then(res => {
        if(res.data.code!=0){
            yearlist.value = [];
            return false;
        }
        yearlist.value = res.data.data || [];
            
    }, err => {
        proxy.$message.error(err);
    });
};
//获取当前学年
let getNowYear = ()=>{
    baseService.get(crmUrl +'/ft/ftchoose/getNowYearly.do').then(res => {
        if(res.data.data){
            searchForm.data.yearly = parseFloat(res.data.data);
        }
        // this.getSessionSearch();
    }, err => {
        proxy.$message.error(err);
    });
};
let getUserInfo = ()=>{
    baseService.get(crmUrl +'/ft/ftchoose/getUserInfo.do').then(res => {
        if(res.data.code !==0){
            return proxy.$message.error(res.data.msg);
        }
        userInfo = res.data || {};
        getPermissionArea();
    }, err => {
        proxy.$message.error(err);
    });
};
let getProductList = ()=>{
    //获取产品线列表
    // let param = new URLSearchParams();
    baseService.post(crmUrl +'/ft/campus/getProductList.do').then(res => {
        if(res.data.code!=0){
            productList.value = [];
            return false;            
        }
        productList.value = res.data.data;
    }, err => {
        proxy.$message.error(err);
    });
};
let getTestList =()=>{
        let param = new URLSearchParams();
        param.append("paperType",0);
        param.append("grade", relateForm.grade);
        param.append("yearly", searchForm.data.yearly || ''); //学年
        param.append("testType", ''); //1大考 2周统练
        //授课地点
        baseService.post(crmUrl +'/ft/ftchoose/getSchoolTestsOfCondition.do',param).then(res => {
            if(res.data.code == 0){
                testList.value = res.data.data.schTests;
                relateForm.testId =  res.data.data.beforeTestId || '';
            }else{
                return proxy.$message.error(res.data.msg);
            }
        }, err => {
            proxy.$message.error(err);
        });
}
let getPermissionArea = (val)=>{
    // this.searchForm[val]='';
    // this.searchForm['classIds']='';
    let param = new URLSearchParams();
    param.append('yearly', searchForm.data.yearly || '');
    param.append('grade', searchForm.data.grade || '');
    param.append('areaId', searchForm.data.areaId || '');
    param.append('functionId', menuParams.id || '');
    param.append('roleId', userInfo.roleId || '');
    baseService.post(crmUrl +'/ft/ftchoose/getSelectPermissions.do', param)
        .then(res => {
            if(res.data.code !==0){
                return proxy.$message.error(res.data.msg);
            }
            proxy.$forceUpdate();
            queryListAll.data= res.data.data || {};
            Object.keys(queryListAll.data).forEach(key=>{
                queryListAll.data[key] = (!queryListAll.data[key] && queryListAll.data[key]!=0) ? [] : queryListAll.data[key];
            })
            if(queryListAll.data['gradeList'] && queryListAll.data['gradeList'].length&& !searchForm.data.grade){
                searchForm.data.grade=queryListAll.data['gradeList'][0].id;
                setTimeout(()=>{
                    getPermissionArea();
                },10)
            }
            if(queryListAll.data['gradeList'] && queryListAll.data['gradeList'].length&& !relateForm.grade){
                relateForm.grade=queryListAll.data['gradeList'][0].id;
                getTestList();
            }
            if(queryListAll.data['areaList'] && queryListAll.data['areaList'].length==1 && !searchForm.data.areaId){
                searchForm.data.areaId=queryListAll.data['areaList'][0].id;
                searchForm.data.areaName=queryListAll.data['areaList'][0].name;
                /*   setTimeout(()=>{
                    _this.getPermissionArea();
                },20) */
            }
            if(val=='testId' ||val=='areaId'){
                getTestList();
            }
    }, err => {
        console.log(err);
    });
}
// 每页数
let sizeChangeHandle=(val)=>{
    pageSize.value = val
    pageNo.value = 1
    getTableData();
};
// 当前页
let currentChangeHandle= (val)=>{
    pageNo.value = val;
    getTableData();
};
let goRelateClass=()=>{
    relateForm.grade = '';
    relateForm.testId = '';
    // relateForm = {
    //     grade: '',
    //     testId: '',
    // }
    getPermissionArea();
    relateVisible.value = true;
};
//一键关联班级--取消
let resetRelate=()=>{
    relateVisible.value = false;
};
//一键关联班级--保存
let toSaveRelate=()=>{
    // let _this = this;
    if(!relateForm.testId){
        proxy.$message.error("请选择考试批次");
        return;
    }
    dialogLoading.value = true;
    let param = new URLSearchParams();
    let classIds = [];
    if(queryListAll.data['masterOrTeacherList'] && queryListAll.data['masterOrTeacherList'].length){//默认传全部
        queryListAll.data['masterOrTeacherList'].forEach(item=>{
            classIds.push(item.id);
        })
    }
    param.append('classIds', classIds.join(','));
    param.append('testId', parseInt(relateForm.testId));
    param.append('grade', parseInt(relateForm.grade));
    dataParam.value = param;
    firstSave('', dialogAddSave);
};
let dialogAddSave = ()=>{
    // let _this = this;
    // 让加载特效更好看一些
    const loadingd  = proxy.$loading({
        lock: true,
        text: '加载中',
        spinner: 'el-icon-loading'
    })
    saveData('post', '/ft/classmanage/binding_class_test_teacher_relation.do', dataParam.value).then(res => {
        loadingd.close();
        if(res.data.code == 0){
            proxy.$message.success("一键关联操作成功！");
            relateVisible.value = false;
        }else{
            proxy.$message.error(res.data.msg);
        }
    }, err => {
        proxy.$message.error("服务器错误！");
    });
};
const { firstSave, saveData } = useSaveFlag(dialogAddSave);
let editSort = (index, row)=>{
    sortVisible.value = true;
    sortForm.sort = row.sort;
    sortForm.classId = row.classId;
};
let resetForm = (sortForm)=>{
    if( sortRulesRef.value){
        sortRulesRef.value.resetFields();
    }
    sortVisible.value = false;
};
//序号输入验证
let changeInput = ()=> {
    var pattern = /^[1-9][0-9]*$/ // 正整数的正则表达式
    // 不符合正整数时
    if (!pattern.test(sortForm.sort)) {
        // input 框绑定的内容为空
        sortForm.sort = ''
    }
};
//序号编辑保存
let toSortSave=(val)=>{
    sortRulesRef.value.validate((valid) => {
        if(valid){
            let params = new URLSearchParams();
            params.append('sort', sortForm.sort || '');
            params.append('classId', sortForm.classId || '');
            baseService.post(crmUrl  + '/ft/classmanage/modify_class_sort.do', params)
                .then(res=>{
                    if(res.data.code == 0){
                        proxy.$message.success("序号更改成功！");
                        sortVisible.value = false;
                        getTableData();
                    }else{
                        proxy.$message.error(res.data.msg);
                    }
                }, err=>{
                    proxy.$message.error("服务器错误！");
                })
        }else{
            proxy.$message.error('请输入必填项!');
            return false;
        }
    });
};
/**
 * 导出
 */
let exportData=()=>{
    loading.value=true;
    let exportObj ={responseType: 'blob'};
    let param = new URLSearchParams();
    param.append("yearly", searchForm.data.yearly || '');// 学年
    param.append("subjectType", searchForm.data.subjectType || '');// 班级科目
    param.append("areaId", searchForm.data.areaId || '');// 上课校区
    param.append("grade", searchForm.data.grade || '');// 年级
    if(searchForm.data.productIds.length > 0){
        param.append("productIds", searchForm.data.productIds.join(','));// 产品线
    } else {
        param.append("productIds", '');
    }
    let classIds = [];
    if(queryListAll.data['masterOrTeacherList'] && queryListAll.data['masterOrTeacherList'].length){//默认传全部
        queryListAll.data['masterOrTeacherList'].forEach(item=>{
            classIds.push(item.id);
        })
    }
    param.append('classIds', classIds.join(','));
    param.append("paperType", searchForm.data.paperType || '');// 试卷种类（0、北京卷 1、全国卷）
    param.append("classType", searchForm.data.classType || '');// 班级类型 （0行政班 1教学班）
    param.append("classId", searchForm.data.classId || '');// 班级id
    param.append("className", searchForm.data.className || '');// 班级名称
    baseService.post(crmUrl + '/ft/classmanage/downloadClassList.do', param, exportObj).then(res=>{
        loading.value = false;
        let headerContent = res.headers['content-disposition'];   
        if(headerContent){
            let filenameStr = headerContent.split('=')[1];
            let blobobj = new Blob([res.data],{type:'application/vnd.ms-excel'});
            downFile(blobobj, decodeURI(filenameStr));
        }
    })
};
let getTableData=(key)=>{
    const { subjectType, areaId, className, classId, yearly, paperType, grade, classType, productIds } = searchForm.data;
    const classIds = queryListAll.data['masterOrTeacherList']?.map(item => item.id) || [];
    const newParam = {
        pageNo: key === 'fist' ? 1 : pageNo.value,
        pageSize: pageSize.value,
        subjectType,
        areaId,
        className,
        classId,
        yearly,
        paperType,
        grade,
        classType,
        productIds: productIds.join(','),
        classIds: classIds.join(','),
    };
    let param = new URLSearchParams();
    Object.keys(newParam).forEach(function(key){
        param.append(key, newParam[key]);
    }) 
    loading.value = true;
    baseService.post(crmUrl +'/ft/classmanage/getClassList.do', param).then(res => {
        loading.value = false;
        if(res.data.code !== 0){
            tableData.value = [];
            totalPage.value = 0;
            return false;
        }
        const { totalSize, items } = res.data.data;
        totalPage.value = totalSize;
        tableData.value = items;
        allNum = res.data.data;
    }, err => {
        proxy.$message.error(err);
    });
};
/**
 * 学生详情
 */
let toStuDetails=()=>{
    isDel.value = true;
    let params = {type: 1, ...searchForm.data}
    store.commit('studentDetails/setRouteParams', params);
    router.push({
        name: 'studentDetails',
        // path: '/studentDetails',
        params
    })
};
/**
 * 新增
 */
let toAdd=()=>{
    router.push('/addqrzclass');
};
/**
 * 编辑
 */
let editClass=(index,item)=>{
    if(item.source == 0){
        let areaName = '';
        //业绩中心
        baseService.post(crmUrl +'/ft/campus/getSchoolAreaList.do')
            .then(res => {
                res.data.data.forEach(each=>{
                    if(each.value === item.areaId){
                        areaName = each.key;
                    }
                })
                isDel.value=true;
                let params = {
                    classId:item.classId,
                    className:item.className,
                    gradeStr:item.gradeStr,
                    grade:item.grade,
                    areaId:item.areaId,
                    areaName:areaName,
                    officeName:item.officeName,
                    officeId:item.officeId,
                    areaId: item.areaId,
                    areaName: item.areaName,
                    classType:item.classType,
                    classLevelType:item.bjbx,
                    subjectType:item.subjectType,
                    status:item.status,
                    masterId:item.masterId,
                    realname:item.realname,
                    yearly:item.yearly,
                    productId:item.productId,
                    productName:item.productName,
                    paperType:item.paperType,
                    classroomId:item.classroomId,
                    doorPlate:item.doorPlate,
                    courseCycId:item.courseCycId,
                    courseCycName:item.courseCycName,
                    salaryType:item.salaryType,
                    realNum:item.realNum,
                    totalNum:item.totalNum,
                    source:item.source,
                    yearly:item.yearly
                }
                store.commit('editqrzclass/setRouteParams', params);
                router.push({
                    name: 'editqrzclass',
                    params: params
                })

            }, err => {
                proxy.$message.error(err);
            });
    }else{
        isDel.value=true;
        let params = {
            classId:item.classId,
            className:item.className,
            gradeStr:item.gradeStr,
            grade:item.grade,
            areaId:item.areaId,
            officeName:item.officeName,
            officeId:item.officeId,
            areaId: item.areaId,
            areaName: item.areaName,
            classType:item.classType,
            classLevelType:item.bjbx,
            subjectType:item.subjectType,
            status:item.status,
            masterId:item.masterId,
            realname:item.realname,
            yearly:item.yearly,
            productId:item.productId,
            productName:item.productName,
            paperType:item.paperType,
            classroomId:item.classroomId,
            doorPlate:item.doorPlate,
            courseCycId:item.courseCycId,
            courseCycName:item.courseCycName,
            salaryType:item.salaryType,
            realNum:item.realNum,
            totalNum:item.totalNum,
            source:item.source,
            yearly:item.yearly
        }
        store.commit('editqrzclass/setRouteParams', params);
        router.push({
            name: 'editqrzclass',
            params: params
        })
    }      
};
/**
 * 学生名单 
 */
let viewStudent=(index,row)=>{
    isDel.value = true;
    let params = {
        id: row.classId,
        name: row.className,
        radio: row.status,
        flag: 4,//班主任班级管理-学生名单跳转时会带flag参数，flag=0；教师班级管理--flag为3；高考全日制班级管理 flag = 4;
        grade:row.grade,
        paperType:row.paperType,
        classType: row.classType,
    }   
    store.commit('showClassStudents/setRouteParams', params);
    router.push({
        name: 'showClassStudents',
        path: '/showClassStudents',
        // name: 'studentList', 
        // path: '/studentList', 
        params : params
    })
}; 

onActivated(()=>{
    // isUseCache为false时才重新刷新获取数据
    // 因为对list使用keep-alive来缓存组件，所以默认是会使用缓存数据的         
    if(route.meta.isUseCache == true){
        tableData.value = []; // 清空原有数据
        getSessionSearch();
    }
    // 通过这个控制刷新
    route.meta.isUseCache = false;
})

onBeforeRouteLeave((to, from ,next)=>{
    if (to.name == 'editqrzclass' || to.name=="addqrzclass" || to.name == 'showClassStudents' || to.name == 'studentDetails') {
        // 根据是否删除操作，进行判断是否需要使用缓存数据
        to.meta.isUseCache = isDel.value; 
        isDel.value=false;
    }else{
        to.meta.isUseCache = false;
    }       
    next();  
})

// export default {
//     name: '',//
//     mixins: [saveFlag],
//     components: {inputNumber},
//     data() {
//         return {
//             dataListLoading: false,
//             searchForm:{
//                 subjectType:'',
//                 areaId:'',
//                 className:'',
//                 productIds: [],
//                 yearly: '',
//                 classId:'',
//                 paperType:'',
//                 grade:'',
//                 classType:''
//             },
//             pageNo: 1,
//             pageSize: 10,
//             totalPage: 0,
//             tableData: [],
//             yearlist:[],
//             productList:[],
//             arealist:[],
//             isDel:false ,
//             delVisible: false,
//             idx: '',//删除id
//             // showOtherParams: false,
//             //一键关联班级
//             dialogLoading: false,
//             relateVisible: false,
//             relateForm: {
//                 testId: '',
//                 grade: '',
//             },
//             relateRules:{
//                 grade:[{required:true,message:'请选择年级!',trigger:'change'}],
//                 testId:[{required:true,message:'请选择考试批次!',trigger:'change'}]
//             },
//             testList: [],
//             dataParam: {}, //保存时做转换的参数存储 
//             sortVisible:false,
//             sortForm:{
//                 sort:''
//             },
//             sortRules:{
//                 sort:[{ required: true, message:"请输入序号", trigger:'change'}]
//             },
//             studentNum: 0,
//             studentNum104: 0,
//             studentNum105: 0,
//             studentNum106: 0,
//             studentNum107: 0,
//             studentNum108: 0,
//             studentNum109: 0,
//             avgNum: 0.00,
//             avgNum104: 0.00,
//             avgNum105: 0.00,
//             avgNum106: 0.00,
//             avgNum107: 0.00,
//             avgNum108: 0.00,
//             avgNum109: 0.00,

//             menuParams: {},//菜单参数
//             userInfo: {},
//             queryListAll: {//所有查询列表
//                 areaList: []
//             }, 
//         }
//     },
//     created() {
//         this.getSessionSearch();        
//     },
//     activated() {
//         // isUseCache为false时才重新刷新获取数据
//         // 因为对list使用keep-alive来缓存组件，所以默认是会使用缓存数据的         
//         if(this.$route.meta.isUseCache == true){
//             this.tableData = []; // 清空原有数据
//             this.getSessionSearch();
//         }
//         // 通过这个控制刷新
//         this.$route.meta.isUseCache = false;
//     },
//     beforeRouteLeave (to, from, next) { 
//         if (to.name == 'editqrzclass' || to.name == 'showClassStudents' || to.name == 'studentDetails') {
//             // 根据是否删除操作，进行判断是否需要使用缓存数据
//             to.meta.isUseCache = this.isDel; 
//             this.isDel=false;
//         }else if(to.name == 'addqrzclass'){
//             to.meta.isUseCache = this.isDel; 
//             this.isDel=false;
//         }else{
//             to.meta.isUseCache = false;
//         }       
//         next();  
//     },  
//     methods: {
//         ...mapMutations('showqrzclassmanage',['setSearchParams','setShowOtherParam','setRouteParams']),
//         getSessionSearch(){
//             if(JSON.stringify(this.$route.params)!='{}'){
//                 this.searchForm = this.$route.params;
//             }else{
//                 let search = JSON.parse(window.sessionStorage.getItem("vuex"))
//                 if(JSON.stringify(search.showqrzclassmanage.menuParams)!='{}'){
//                     this.menuParams = {...this.menuParams, ...search.showqrzclassmanage.menuParams};
//                 }    
//             }
//             this.getYears();
//             this.getNowYear();
//             setTimeout(()=>{
//                 this.getUserInfo();
//             }, 0)
//             // this.getTableData();
//             this.getProductList();    
//         },
//         //获取用户信息
//         getUserInfo(){
//             let _this = this;
//             this.$axios.get('/ft/ftchoose/getUserInfo.do')
//                 .then(res => {
//                     if(res.data.code !==0){
//                         _this.$message.error(res.data.msg);
//                         return false;
//                     }
//                     _this.userInfo = res.data || {};
//                     _this.getPermissionArea();
//             }, err => {
//                 this.$message.error(err);
//             });
//         },
//         /**
//          * 获取所有查询列表数据
//          * @functionId 菜单id
//          * @roleId 角色id
//          */
//         getPermissionArea(val){
//             let _this = this;
//             this.searchForm[val]='';
//             this.searchForm['classIds']='';
//             let param = new URLSearchParams();
//             param.append('yearly', this.searchForm.yearly || '');
//             param.append('grade', this.searchForm.grade || '');
//             param.append('areaId', this.searchForm.areaId || '');
//             param.append('functionId', this.menuParams.id || '');
//             param.append('roleId', this.userInfo.roleId || '');
//             this.$axios.post('/ft/ftchoose/getSelectPermissions.do', param)
//                 .then(res => {
//                     if(res.data.code !==0){
//                         _this.$message.error(res.data.msg);
//                         return false;
//                     }
//                     _this.$forceUpdate();
//                     _this.queryListAll= res.data.data || {};
//                     Object.keys(_this.queryListAll).forEach(key=>{
//                         _this.queryListAll[key] = (!_this.queryListAll[key] && _this.queryListAll[key]!=0) ? [] : _this.queryListAll[key];
//                     })
//                     if(_this.queryListAll['gradeList'] && _this.queryListAll['gradeList'].length&& !_this.searchForm.grade){
//                         _this.searchForm.grade=_this.queryListAll['gradeList'][0].id;
//                         setTimeout(()=>{
//                             _this.getPermissionArea();
//                         },10)
//                     }
//                     if(_this.queryListAll['gradeList'] && _this.queryListAll['gradeList'].length&& !_this.relateForm.grade){
//                         _this.relateForm.grade=_this.queryListAll['gradeList'][0].id;
//                         _this.getTestList();
//                     }
//                     if(_this.queryListAll['areaList'] && _this.queryListAll['areaList'].length==1 && !_this.searchForm.areaId){
//                         _this.searchForm.areaId=_this.queryListAll['areaList'][0].id;
//                         _this.searchForm.areaName=_this.queryListAll['areaList'][0].name;
//                       /*   setTimeout(()=>{
//                             _this.getPermissionArea();
//                         },20) */
//                     }
//                     if(val=='testId' ||val=='areaId'){
//                         _this.getTestList();
//                     }
//             }, err => {
//                 console.log(err);
//             });
//         },
//         //获取当前学年
//         getNowYear(){
//             this.$axios.get('/ft/ftchoose/getNowYearly.do')
//                 .then(res => {
//                     if(res.data.data){
//                         this.searchForm.yearly = Number(res.data.data);
//                     }
//                     // this.getSessionSearch();
//             }, err => {
//                 this.$message.error(err);
//             });
//         },
//         // 每页数
//         sizeChangeHandle (val) {
//             this.pageSize = val
//             this.pageNo = 1
//             this.getTableData();
//         },
//         // 当前页
//         currentChangeHandle (val) {
//             this.pageNo = val;
//             this.getTableData();
//         }, 
      
//         getYears(){
//             //获取学年
//             this.$axios.post('/ft/campus/getSchoolYearList.do')
//                 .then(res => {
//                     if(res.data!=null&&res.data.code==0){
//                         //获取菜单列表
//                     this.yearlist = res.data.data;
//                     }else{
//                     this.yearlist = [];
//                     }
//                 this.dataListLoading = false;
                    
//             }, err => {
//                 this.$message.error(err);
//             });
//         },
//         getProductList(){
//         //获取产品线列表
//             // let param = new URLSearchParams();
//             this.$axios.post('/ft/campus/getProductList.do')
//                 .then(res => {
//                     if(res.data!=null&&res.data.code==0){
//                         //获取菜单列表
//                         this.productList = res.data.data;
//                     }else{
//                         this.productList = [];
//                     }
//                 this.dataListLoading = false;
//             }, err => {
//                 this.$message.error(err);
//             });
//         },
//         getOfficeList(){
//             //上课校区
//             this.$axios.post('/ft/ftchoose/getQrzAreas.do')
//                 .then(res => {
//                     if(res.data){
//                         //获取菜单列表
//                         this.arealist = res.data;
//                     }
//             }, err => {
//                 console.log(err);
//             });
//         },
        
//         submitForm(searchForm) {
//             this.dataListLoading = true;
//             this.pageNo = 1
//             this.getTableData();
//         },
//         toAdd(){
//             this.$router.push('/addqrzclass')
//         },
//         editClass(index,item){
//             if(item.source == 0){
//                 let areaName = '';
//                 //业绩中心
//                 this.$axios.post('/ft/campus/getSchoolAreaList.do')
//                     .then(res => {
//                         res.data.data.forEach(each=>{
//                             if(each.value === item.areaId){
//                                 areaName = each.key;
//                             }
//                         })
//                         this.isDel=true;
//                         let params = {
//                             classId:item.classId,
//                             className:item.className,
//                             gradeStr:item.gradeStr,
//                             grade:item.grade,
//                             areaId:item.areaId,
//                             areaName:areaName,
//                             officeName:item.officeName,
//                             officeId:item.officeId,
//                             areaId: item.areaId,
//                             areaName: item.areaName,
//                             classType:item.classType,
//                             classLevelType:item.bjbx,
//                             subjectType:item.subjectType,
//                             status:item.status,
//                             masterId:item.masterId,
//                             realname:item.realname,
//                             yearly:item.yearly,
//                             productId:item.productId,
//                             productName:item.productName,
//                             paperType:item.paperType,
//                             classroomId:item.classroomId,
//                             doorPlate:item.doorPlate,
//                             courseCycId:item.courseCycId,
//                             courseCycName:item.courseCycName,
//                             salaryType:item.salaryType,
//                             realNum:item.realNum,
//                             totalNum:item.totalNum,
//                             source:item.source,
//                             yearly:item.yearly
//                         }
//                         this.$store.commit('editqrzclass/setRouteParams', params);
//                         this.$router.push({
//                             name: 'editqrzclass',
//                             params: params
//                         })

//                     }, err => {
//                         this.$message.error(err);
//                     });
//             }else{
//                 this.isDel=true;
//                 let params = {
//                     classId:item.classId,
//                     className:item.className,
//                     gradeStr:item.gradeStr,
//                     grade:item.grade,
//                     areaId:item.areaId,
//                     officeName:item.officeName,
//                     officeId:item.officeId,
//                     areaId: item.areaId,
//                     areaName: item.areaName,
//                     classType:item.classType,
//                     classLevelType:item.bjbx,
//                     subjectType:item.subjectType,
//                     status:item.status,
//                     masterId:item.masterId,
//                     realname:item.realname,
//                     yearly:item.yearly,
//                     productId:item.productId,
//                     productName:item.productName,
//                     paperType:item.paperType,
//                     classroomId:item.classroomId,
//                     doorPlate:item.doorPlate,
//                     courseCycId:item.courseCycId,
//                     courseCycName:item.courseCycName,
//                     salaryType:item.salaryType,
//                     realNum:item.realNum,
//                     totalNum:item.totalNum,
//                     source:item.source,
//                     yearly:item.yearly
//                 }
//                 this.$store.commit('editqrzclass/setRouteParams', params);
//                 this.$router.push({
//                     name: 'editqrzclass',
//                     params: params
//                 })
//             }
                
        
            
//         },
//         handleDelete(row) {
//             this.idx = row.classId;
//             this.delVisible = true;
//         },
//         deleteRow(){
//             let param = new URLSearchParams();
//             param.append('classId', this.idx);
//             this.$axios.post('/ft/classmanage/delClass.do',param)
//                 .then(res => {
//                     if(res.data.code == 0){
//                         this.$message.success('删除成功！');
//                         this.dataListLoading = true;
//                         this.getTableData();                            
//                         this.delVisible = false;
//                     }else{
//                         this.$message.error(res.data.msg);
//                     }
//             }, err => {
//                 this.$message.error(err);
//             });
//         },
//         viewStudent(index,row){
//             this.isDel = true;
//             let params = {
//                 id: row.classId,
//                 name: row.className,
//                 radio: row.status,
//                 flag: 4,//班主任班级管理-学生名单跳转时会带flag参数，flag=0；教师班级管理--flag为3；高考全日制班级管理 flag = 4;
//                 grade:row.grade,
//                 paperType:row.paperType,
//                 classType: row.classType,
//             }   
//             this.$store.commit('showClassStudents/setRouteParams', params);
//             this.$router.push({
//                 name: 'showClassStudents',
//                 path: '/showClassStudents',
//                 // name: 'studentList', 
//                 // path: '/studentList', 
//                 params : params
//             })
//         },
//         //获取考试批次
//         getTestList(){
//             let param = new URLSearchParams();
//             param.append("paperType",0);
//             param.append("grade", this.relateForm.grade);
//             param.append("yearly", this.searchForm.yearly || ''); //学年
//             param.append("testType", ''); //1大考 2周统练
//             //授课地点
//             this.$axios.post('/ft/ftchoose/getSchoolTestsOfCondition.do',param)
//                 .then(res => {
//                     if(res.data.code == 0){
//                         this.testList = res.data.data.schTests;
//                         this.relateForm.testId =  res.data.data.beforeTestId || '';
//                     }else{
//                         this.$message.error(res.data.msg);
//                     }
//             }, err => {
//                 this.$message.error(err);
//             });
//         },
//         // 一键关联班级
//         goRelateClass(){
//             this.relateForm = {
//                 grade: '',
//                 testId: '',
//             }
//             this.getPermissionArea();
//             this.relateVisible = true;
//         },
//         //一键关联班级--取消
//         resetRelate(){
//             this.relateVisible = false;
//         },
//         //一键关联班级--保存
//         toSaveRelate(){
//             let _this = this;
//             if(!_this.relateForm.testId){
//                 _this.$message.error("请选择考试批次");
//                 return;
//             }
//             _this.dialogLoading = true;
//             let param = new URLSearchParams();
//             let classIds = [];
//             if(this.queryListAll['masterOrTeacherList'] && this.queryListAll['masterOrTeacherList'].length){//默认传全部
//                 this.queryListAll['masterOrTeacherList'].forEach(item=>{
//                     classIds.push(item.id);
//                 })
//             }
//             param.append('classIds', classIds.join(','));
//             param.append('testId', parseInt(this.relateForm.testId));
//             param.append('grade', parseInt(this.relateForm.grade));
//             _this.dataParam = param;
//             this.firstSave();
//         },
//         dialogAddSave(){
//             let _this = this;
//             this.saveData('post', '/ft/classmanage/binding_class_test_teacher_relation.do', _this.dataParam).then(res => {
//                 _this.dialogLoading=false;
//                 if(res.data.code == 0){
//                     this.$message.success("一键关联操作成功！");
//                         this.relateVisible = false;
//                 }else{
//                     this.$message.error(res.data.msg);
//                 }
//             }, err => {
//                 _this.$message.error("服务器错误！");
//             });
//         },
//         editSort(index, row){
//             this.sortVisible = true;
//             this.sortForm.sort = row.sort;
//             this.sortForm.classId = row.classId;
//         },
//         resetForm(sortForm){
//             if(this.$refs[sortForm]){
//                 this.$refs[sortForm].resetFields();
//             }
//             this.sortVisible = false;
//         },
//         //序号输入验证
//         changeInput() {
//             var pattern = /^[1-9][0-9]*$/ // 正整数的正则表达式
//             // 不符合正整数时
//             if (!pattern.test(this.sortForm.sort)) {
//                 // input 框绑定的内容为空
//                 this.sortForm.sort = ''
//             }
//         },
//         //序号编辑保存
//         toSortSave(val){
//             this.$refs['sortRules'].validate((valid) => {
//                 if(valid){
//                     let params = new URLSearchParams();
//                     params.append('sort', this.sortForm.sort || '');
//                     params.append('classId', this.sortForm.classId || '');
//                     this.$axios.post(baseUrl + '/ft/classmanage/modify_class_sort.do', params)
//                         .then(res=>{
//                             if(res.data.code == 0){
//                                 this.$message.success("序号更改成功！");
//                                 this.sortVisible = false;
//                                 this.getTableData();
//                             }else{
//                                 this.$message.error(res.data.msg);
//                             }
//                         }, err=>{
//                             this.$message.error("服务器错误！");
//                         })
//                 }else{
//                     this.$message.error('请输入必填项!');
//                     return false;
//                 }
//             });
//         }, 
//         /**
//          * 导出
//          */
//         exportData(){
//             this.dataListLoading=true;
//             let exportObj ={responseType: 'blob'};
//             let param = new URLSearchParams();
//             param.append("yearly", this.searchForm.yearly || '');// 学年
//             param.append("subjectType", this.searchForm.subjectType || '');// 班级科目
//             param.append("areaId", this.searchForm.areaId || '');// 上课校区
//             param.append("grade", this.searchForm.grade || '');// 年级
//             if(this.searchForm.productIds.length > 0){
//                 param.append("productIds", this.searchForm.productIds.join(','));// 产品线
//             } else {
//                 param.append("productIds", '');
//             }
//             let classIds = [];
//             if(this.queryListAll['masterOrTeacherList'] && this.queryListAll['masterOrTeacherList'].length){//默认传全部
//                 this.queryListAll['masterOrTeacherList'].forEach(item=>{
//                     classIds.push(item.id);
//                 })
//             }
//             param.append('classIds', classIds.join(','));
//             param.append("paperType", this.searchForm.paperType || '');// 试卷种类（0、北京卷 1、全国卷）
//             param.append("classType", this.searchForm.classType || '');// 班级类型 （0行政班 1教学班）
//             param.append("classId", this.searchForm.classId || '');// 班级id
//             param.append("className", this.searchForm.className || '');// 班级名称
//             this.$axios.post(baseUrl + '/ft/classmanage/downloadClassList.do', param, exportObj)
//             .then(res=>{
//                 let headerContent = res.headers['content-disposition'];   
//                 if(headerContent){
//                     let filenameStr = headerContent.split('=')[1];
//                     let blobobj = new Blob([res.data],{type:'application/vnd.ms-excel'});
//                     downFile(blobobj, decodeURI(filenameStr));
//                 }
//                 this.dataListLoading = false;
//             })
//         },
//         getTableData(){
//             let _this = this;
//             this.dataListLoading = true;
//             let param = new URLSearchParams();
//             if(this.pageNo != null && this.pageNo != undefined){
//                 param.append("pageNo", this.pageNo);
//             }
//             if(this.pageSize != null && this.pageSize != undefined){
//                 param.append("pageSize",this.pageSize);
//             }
//             if(this.searchForm.subjectType != null && this.searchForm.subjectType != undefined){
//                 param.append("subjectType", this.searchForm.subjectType);// 班级科目
//             }
//             if(this.searchForm.areaId != null && this.searchForm.areaId != undefined){
//                 param.append("areaId", this.searchForm.areaId);// 授课地点
//             }
//             if(this.searchForm.className != null && this.searchForm.className != undefined){
//                 param.append("className", this.searchForm.className);// 班级名称
//             }
//             let classIds = [];
//             if(this.queryListAll['masterOrTeacherList'] && this.queryListAll['masterOrTeacherList'].length){//默认传全部
//                 this.queryListAll['masterOrTeacherList'].forEach(item=>{
//                     classIds.push(item.id);
//                 })
//             }
//             param.append('classIds', classIds.join(','));
//             if(this.searchForm.classId != null && this.searchForm.classId != undefined){
//                 param.append("classId", this.searchForm.classId);// 班级id
//             }
//             if(this.searchForm.yearly != null && this.searchForm.yearly != undefined){
//                 param.append("yearly", this.searchForm.yearly);// 学年
//             }
//             if(this.searchForm.productIds.length > 0){
//                 param.append("productIds", this.searchForm.productIds.join(','));// 产品线
//             } else {
//                 param.append("productIds", '');// 产品线
//             }
//             if(this.searchForm.paperType != null && this.searchForm.paperType != undefined){
//                     param.append("paperType", this.searchForm.paperType);// 试卷种类（0、北京卷 1、全国卷）
//             }
//             if(this.searchForm.grade != null && this.searchForm.grade != undefined){
//                 param.append("grade", this.searchForm.grade);// 年级
//             }
//             if(this.searchForm.classType != null && this.searchForm.classType != undefined){
//                 param.append("classType", this.searchForm.classType);// 班级类型 （0行政班 1教学班）
//             }
//             this.$axios.post('/ft/classmanage/getClassList.do',param).then(res => {
//                 if(res.data!=null&&res.data.code==0){
//                     let data = res.data.data;
//                     this.totalPage = data.totalSize;
//                     this.tableData = data.items;
//                     this.studentNum = data.studentNum;
//                     this.studentNum104 = data.studentNum104;
//                     this.studentNum105 = data.studentNum105;
//                     this.studentNum106 = data.studentNum106;
//                     this.studentNum107 = data.studentNum107;
//                     this.studentNum108 = data.studentNum108;
//                     this.studentNum109 = data.studentNum109;
//                     this.avgNum = data.avgNum;
//                     this.avgNum104 = data.avgNum104;
//                     this.avgNum105 = data.avgNum105;
//                     this.avgNum106 = data.avgNum106;
//                     this.avgNum107 = data.avgNum107;
//                     this.avgNum108 = data.avgNum108;
//                     this.avgNum109 = data.avgNum109;
//                 }else{
//                     this.tableData = [];
//                     this.totalPage = 0;
//                 }
//                 this.dataListLoading = false;
//             }, err => {
//                 this.$message.error(err);
//             });
//         },
//         /**
//          * 学生详情
//          */
//         toStuDetails(){
//             this.isDel = true;
//             let params = {type: 1, ...this.searchForm}
//             this.$store.commit('studentDetails/setRouteParams', params);
//             this.$router.push({
//                 name: 'studentDetails',
//                 path: '/studentDetails',
//                 params : params
//             })
//         }
//     }
// }

</script>

<style scoped>
    .icon-rotate{
        transform: rotate(180deg);
    }
    .el-icon-arrow-down.show-list{
        cursor: pointer;
        line-height: 32px;
        margin-left: 10px;
    }
    .handle-box {
        margin-bottom: 20px;
    }

    .handle-select {
        width: 120px;
    }

    .handle-input {
        width: 300px;
        display: inline-block;
    }
    .del-dialog-cnt{
        font-size: 16px;
        text-align: center
    }
    .red{
        color: #ff0000;
    }
    .mr10{
        margin-right: 10px;
    }
    .searchbt{
        text-align: center;
        /* margin-bottom: 10px; */
        margin-left: 10px;
    }
    .box-p-pre{
        display: inline-block;
        vertical-align: bottom;
        line-height: 40px;
    }
    .box-p{
        display: inline-block;
        font-size: 12px;
        margin-right: 10px;
        cursor: pointer;
        color: #409EFF;
        vertical-align: bottom;
    }
    .box-p:hover span{
        border-bottom: 1px solid #409EFF;
    }
    .totalN{
        border: 1px solid #EBEEF5;
        padding: 15px 4%;
        font-size: 13px;
    }
    .totalN div{
        width: 100%;
        display: flex;
        padding: 6px 0;
    }
    .totalN p{
        flex: 1;
    }
    .totalN p span{
        display: inline-block;
        width: 80px;
    }
    .el_div_num{
        color: #409EFF;
        cursor: pointer;
        /* margin-right: 40px; */
    }
</style>